<?php
require('../public/connection.php');

checkLogin();

$data = json_decode(file_get_contents('php://input'), true);

if (empty($data["id"])) {
    die(json_encode(array("code" => 10010, "msg" => "json格式错误", "data" => null)));
}

$query = mysqli_query($connect, "delete from users where id={$data['id']}");
if (!$query) {
    die(json_encode(array("code" => 500, "msg" => "服务器异常", "data" => null)));
}

die(json_encode(array("code" => 0, "msg" => "删除成功", "data" => null)));
